package com.syp.jrx.mapper;

import com.syp.jrx.model.Customer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CustomerMapper {

    @Select({
            "select cust_id,surname,gender,educa_des,mar_des,birthday,address",
            "from customer where cust_id=#{cust_id}"
    })
    Customer selectById(int cust_id);

    @Select({
            "select cust_id,surname,gender,educa_des,mar_des,birthday,address",
            "from customer where surname=#{surname}"
    })
    Customer selectByName(String surname);

    @Insert({
            "insert into customer(surname,gender,educa_des,mar_des,birthday,address)",
            "values(#{surname},#{gender},#{educa_des},#{mar_des},#{birthday},#{address})"
    })
    int insertCustomer(Customer customer);

    @Update({
            "update customer set educa_des=#{arg1} where cust_id=#{arg0}"
    })
    int updateEduca(int cust_id, String educa_des);

}
